<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>3d效果</title>
  </head>
  <body>
    <style>
      main {
        width: 400px;
        height: 400px;
        /* padding-top: 300px; */
        margin: 300px auto;
        border: solid 1px black;
        transform-style: preserve-3d;
        transform: perspective(900px) rotateX(45deg);
      }
      div {
        width: 100px;
        height: 100px;
        background-color: coral;
        transform: translateX(150%) rotateY(45deg);
      }
      main:hover div {
        transition: 1s;
        transform: translateX(150%) translateY(300%) rotateY(45deg);
      }
    </style>
    <main>
      <div></div>
    </main>
  </body>
</html>
